import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ActivityRecordVO, ActivityRecordForm, ActivityRecordQuery } from '@/api/module/activity/record/types';

/**
 * 查询活动报名记录列表
 * @param query
 * @returns {*}
 */

export const listActivityRecord = (query?: ActivityRecordQuery): AxiosPromise<ActivityRecordVO[]> => {
  return request({
    url: '/module/activityRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询活动报名记录详细
 * @param id
 */
export const getActivityRecord = (id: string | number): AxiosPromise<ActivityRecordVO> => {
  return request({
    url: '/module/activityRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增活动报名记录
 * @param data
 */
export const addActivityRecord = (data: ActivityRecordForm) => {
  return request({
    url: '/module/activityRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改活动报名记录
 * @param data
 */
export const updateActivityRecord = (data: ActivityRecordForm) => {
  return request({
    url: '/module/activityRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除活动报名记录
 * @param id
 */
export const delActivityRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/module/activityRecord/' + id,
    method: 'delete'
  });
};
